package com.example.dwhne.leonweather.other;

import com.example.dwhne.leonweather.other.HotCitiesBean;
import com.google.gson.Gson;

import org.json.JSONObject;

public class Utility {
    public static HotCitiesBean handleHotCityResponse (String response){
        try {
            JSONObject jsonObject = new JSONObject(response);
//            JSONArray jsonArray = jsonObject.getJSONArray("HeWeather6");
//            String weatherContent = jsonArray.getJSONObject(0).toString();
            String weatherContent = jsonObject.toString();
            return new Gson().fromJson(weatherContent, HotCitiesBean.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
